/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-12-15
*/
package com.rzico.basics.entity;

import com.alibaba.fastjson.JSON;
import com.rzico.basics.model.ChefMeta;
import io.swagger.annotations.Api;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * <pre>
 *   名厨档案数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "wx_chef")
public class Chef{
    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "创建日期" )
    protected java.util.Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected java.util.Date modifyDate;

    @ApiModelProperty(value = "厨师姓名" )
    protected String name;

    @ApiModelProperty(value = "达人头像" )
    protected String avatar;

    @ApiModelProperty(value = "厨师简介" )
    protected String title;

    @ApiModelProperty(value = "厨师详情" )
    protected String content;

    @ApiModelProperty(value = "招牌菜([{thumbnail:缩例图,name:菜名}])" )
    protected String meta;

    @ApiModelProperty(value = "擅长" )
    protected String beGoodAt;

    @ApiModelProperty(value = "星级" )
    protected Integer score;

    @ApiModelProperty(value = "获赞" )
    protected Integer love;

    @ApiModelProperty(value = "所属商户" )
    protected Long enterpriseId;

    @JsonIgnore
    @ApiModelProperty(value = "是否删除" ,hidden = true )
    protected Boolean deleted;

    @JsonIgnore
    @ApiModelProperty(value = "创建者" ,hidden = true )
    protected String createBy;

    @JsonIgnore
    @ApiModelProperty(value = "更新者" ,hidden = true )
    protected String modifyBy;

    @ApiModelProperty(value = "是否已关注")
    @Transient
    protected boolean followFlag;


    public List<ChefMeta> getChefMeta() {
        if (getMeta()!=null) {
            return JSON.parseArray(getMeta(),ChefMeta.class);
        } else {
            return null;
        }
    }

    public void setChefMeta(List<ChefMeta> value) {
        if (value!=null) {
            setMeta(JSON.toJSONString(value));
        } else {
            setMeta(null);
        }
    }

}
